from langchain_openai import OpenAI
from langchain.prompts import PromptTemplate

llm = OpenAI(
    max_retries=1,
    max_tokens=1024,
    temperature=0,
    openai_api_key="sk-rgymzddvnnrgwawnkevkdzlxkxfvhbviqgibbfgpvsyoqtur",
    openai_api_base="https://api.siliconflow.cn/v1",
    model="deepseek-ai/DeepSeek-R1-0528-Qwen3-8B"
)

prompt = PromptTemplate.from_template("输出一首古诗，名字是：{name} ")
prompt_format = prompt.format(name='静夜思')
print(prompt_format)

answer = llm.invoke(prompt_format)
print(answer)
